import {
    EntityTable,
    EntityTablePageResult,
    TableQueryParam,
} from './types';
import request from '@/utils/request';
import {AxiosPromise} from 'axios';

/**
 * 获取实体分页列表
 *
 * @taskParam queryParams
 */
export function listSchemaEntities(queryParams: TableQueryParam): AxiosPromise<EntityTablePageResult> {
    return request({
        url: '/manager/schema/entities',
        method: 'post',
        data: queryParams,
    });
}

/**
 * 获取实体分页列表
 *
 * @taskParam queryParams
 */
export function getSchemaEntity(entityType: string): AxiosPromise<EntityTable> {
    return request({
        url: '/manager/schema/entity',
        method: 'get',
        params: {entityType: entityType}
    });
}

/**
 * 获取实体分页列表
 *
 * @taskParam queryParams
 */
export function listSchemaNames(): AxiosPromise<string[]> {
    return request({
        url: '/manager/schema/names',
        method: 'get',
    });
}
